package org.iubbo.proxy.dao;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;
import org.iubbo.proxy.model.po.RegisterConfigPO;

import java.util.List;

/**
 * dubbo配置中心
 *
 * @author flamingstar
 * @date 2021/2/3
 * @version V2.1
 */
@Mapper
public interface DubboRegisterConfigDao extends BaseMapper<RegisterConfigPO> {
    @Select("select * from t_register_config where type=#{type}")
    List<RegisterConfigPO> selectAllRegisterConfig(int type);

    @Insert("insert into t_register_config(host,ip,type,create_time,update_time) values(#{host},#{ip},#{type},#{createTime},#{updateTime})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int insertOne(RegisterConfigPO registerConfigPO);

    @Select("select * from t_register_config where type=#{type} and host=#{host} and ip=#{ip}")
    List<RegisterConfigPO> getRegisterConfig(@Param("type") int type, @Param("host")String host, @Param("ip")String ip);
}
